package cn.tedu.imop.marketing.service.impl;

import cn.tedu.imop.common.annotation.RequiredOperationLog;
import cn.tedu.imop.common.pojo.PageData;
import cn.tedu.imop.marketing.dao.repository.ActivityRepository;
import cn.tedu.imop.marketing.entity.Activity;
import cn.tedu.imop.marketing.service.ActivityService;
import org.springframework.stereotype.Service;

@Service
public class ActivityServiceImpl implements ActivityService {
    private final ActivityRepository activityRepository;

    public ActivityServiceImpl(ActivityRepository activityRepository) {
        this.activityRepository = activityRepository;
    }

    @Override
    public Boolean createActivity(Activity activity) {
        //保存活动自身信息
        activityRepository.insertActivity(activity);
        //调用附件服务绑定活动图片
        bindActivityImages(activity);
        return true;
    }
    private void bindActivityImages(Activity activity) {

    }

    @RequiredOperationLog("浏览活动")
    @Override
    public PageData<Activity> getActivityList(Activity activity) {
        return activityRepository.selectActivityList(activity);
    }
}
